3ec70a3ae1c79a2d8a556f90bb4ccb2c5e239eb2,core/src/main/java/org/commonjava/maven/ext/manip/impl/ProjectVersioningManipulator.java,ProjectVersioningManipulator,applyVersioningChanges,#ManipulationSession#List#Project#VersioningState#,162

Before Change


                        {
                            if (gav.getVersionString().startsWith( "${" ))
                            {
                                PropertiesUtils.updateProperties( session, new HashSet<>( projects ), false, extractPropertyName( gav.getVersionString() ), newVersion );
                            }
                            else
                            {

After Change


                logger.info( "Changed parent version to: " + newVersion + " in " + parent );
                if (parentGAV.getVersionString().startsWith( "${" ))
                {
                    if ( PropertiesUtils.updateProperties( session, new HashSet<>( projects ), false, extractPropertyName( parentGAV.getVersionString() ), newVersion ) == PropertiesUtils.PropertyUpdate.NOTFOUND )
                    {
                        logger.error( "Unable to find property {} to update with version {}", parentGAV.getVersionString(), newVersion );
                    }
                }
                else
                {
                    parent.setVersion( newVersion );
                }
                changed = true;
            }
        }

        ProjectVersionRef gav = new SimpleProjectVersionRef( g, model.getArtifactId(), v );
        if ( model.getVersion() != null )
        {
            final String newVersion = versionsByGAV.get( gav );
            logger.info( "Looking for new version: " + gav + " (found: " + newVersion + ")" );
            if ( newVersion != null && model.getVersion() != null )
            {
                if (gav.getVersionString().startsWith( "${" ))
                {
                    if ( PropertiesUtils.updateProperties( session, new HashSet<>( projects ), false, extractPropertyName( gav.getVersionString() ), newVersion ) == PropertiesUtils.PropertyUpdate.NOTFOUND )
                    {
                        logger.error( "Unable to find property {} to update with version {}", gav.getVersionString(), newVersion );
                    }
                }
                else
                {
                    model.setVersion( newVersion );
                }
                logger.info( "Changed main version in " + gav( model ) );
                changed = true;
            }
        }
        // If we are at the inheritance root and there is no explicit version instead
        // inheriting the version from the parent BUT the parent is not in this project
        // force inject the new version.
        else if ( changed == false && model.getVersion() == null && project.isInheritanceRoot())
        {
            final String newVersion = versionsByGAV.get( gav );
            logger.info( "Looking to force inject new version for : " + gav + " (found: " + newVersion + ")" );
            if (newVersion != null)
            {
                model.setVersion( newVersion );
                changed = true;
            }
        }

        final Set<ModelBase> bases = new HashSet<>();
        bases.add( model );

        final List<Profile> profiles = model.getProfiles();
        if ( profiles != null )
        {
            bases.addAll( profiles );
        }

        final PropertyInterpolator pi = new PropertyInterpolator( model.getProperties(), project );

        for ( final ModelBase base : bases )
        {
            final DependencyManagement dm = base.getDependencyManagement();
            if ( dm != null && dm.getDependencies() != null )
            {
                for ( final Dependency d : dm.getDependencies() )
                {
                    if ( isEmpty (pi.interp( d.getVersion() )))
                    {
                        logger.trace( "Skipping dependency " + d + " as empty version." );
                        continue;
                    }
                    try
                    {
                        gav = new SimpleProjectVersionRef( pi.interp( d.getGroupId() ),
                                                           pi.interp( d.getArtifactId() ),
                                                           pi.interp( d.getVersion() ) );
                        final String newVersion = versionsByGAV.get( gav );
                        if ( newVersion != null )
                        {
                            if (d.getVersion().startsWith( "${" ))
                            {
                                if ( PropertiesUtils.updateProperties( session, new HashSet<>( projects ), false, extractPropertyName( d.getVersion() ), newVersion ) == PropertiesUtils.PropertyUpdate.NOTFOUND )
                                {
                                    logger.error( "Unable to find property {} to update with version {}", d.getVersion(), newVersion );
                                }
                            }
                            else
                            {
                                d.setVersion( newVersion );
                            }
                            logger.info( "Changed managed: " + d + " in " + base + " to " + newVersion + " from " + gav.getVersionString() );
                            changed = true;
                        }
                    }
                    catch ( InvalidRefException ire)
                    {
                        logger.debug( "Unable to change version for dependency {} due to {} ", d.toString(), ire );
                    }
                }
            }

            if ( base.getDependencies() != null )
            {
                for ( final Dependency d : base.getDependencies() )
                {
                    try
                    {
                        if ( isEmpty (pi.interp( d.getVersion() )))
                        {
                            logger.trace( "Skipping dependency " + d + " as empty version." );
                            continue;
                        }

                        gav = new SimpleProjectVersionRef( pi.interp( d.getGroupId() ),
                                                           pi.interp( d.getArtifactId() ),
                                                           pi.interp( d.getVersion() ) );

                        final String newVersion = versionsByGAV.get( gav );

                        if ( newVersion != null && d.getVersion() != null )
                        {
                            if (d.getVersion().startsWith( "${" ))
                            {
                                if ( PropertiesUtils.updateProperties( session, new HashSet<>( projects ), false, extractPropertyName( d.getVersion() ), newVersion ) == PropertiesUtils.PropertyUpdate.NOTFOUND )
                                {
                                    logger.error( "Unable to find property {} to update with version {}", d.getVersion(), newVersion );
                                }